#include<bits/stdc++.h>
using namespace std;

int cnt=0;
int vs[100001];
int Left[100001];
int Right[100001];
int T;
int n,m,L,V;
int d[100001];
int v[100001];
int a[100001];
int p[100001];

int main()
{
	freopen("detect.in","r",stdin);
	freopen("detect.out","w",stdout);
	cin>>T;
	while(T--)
	{
		cnt=0;
		fill(geshu+1,geshu+1+n,0);
		fill(vs+1,vs+1+n,0);
		fill(Left+1,Left+1+n,0);
		fill(Right+1,Right+1+n,0);
		cin>>n>>m>>L>>V;
		for(int i=1;i<=n;i++)
		{
			cin>>d[i]>>v[i]>>a[i];
		}
		for(int i=1;i<=m;i++)
		{
			cin>>p[i];
		}
		for(int i=1;i<=n;i++)
		{
			if(a[i]<0)
			{
				if(v[i]<=V) continue;
				else
				{
					int l=d[i];
					int r=l+(V*V-v[i]*v[i])*1.0/(2*a[i]);
					if(r<L)
					{
						Right[i]=upper_bound(p+1,p+1+m,r)-p-1;
						Left[i]=lower_bound(p+1,p+1+m,l)-p;
					}
					else
					{
						Left[i]=lower_bound(p+1,p+1+m,l)-p;
						Right[i]=m;
					}
					if(Left[i]<=Right[i])
					{
						vs[i]=1;
						cnt++;
						cout<<i<<" too fast\n";
					}
				}
			}
			else if(a[i]==0)
			{
				if(v[i]<=V) continue;
				else
				{
					Left[i]=d[i];
					Right[i]=L;
					if(Left[i]<=Right[i])
					{
						vs[i]=1;
						cnt++;
						cout<<i<<" too fast\n";
					}
				}
			}
			else if(a[i]>0)
			{
				if(v[i]>V)
				{
					
					Left[i]=lower_bound(p+1,p+1+m,d[i])-p;
					Right[i]=m;
					if(Left[i]<=Right[i])
					{
						vs[i]=1;
						cnt++;
						cout<<i<<" too fast\n";
					}
				}
				else
				{
					int l=l+(V*V-v[i]*v[i])*1.0/(2*a[i]);
					if(l<L)
					{
						Right[i]=m;
						Left[i]=lower_bound(p+1,p+1+m,l)-p;
						if(Left[i]<=Right[i])
						{
							vs[i]=1;
							cnt++;
							cout<<i<<" too fast\n";
						}
					}
					else
					{
						continue;
					}
				}
			}
			
		}
		cout<<cnt<<' '<<(int)log2(m)<<endl;
	}
	return 0;
}
